package cn.iocoder.an.module.business.dal.dataobject.equipmentmanage;

import cn.idev.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.an.framework.mybatis.core.dataobject.BaseDO;
import org.apache.ibatis.type.DateTypeHandler;
import org.springframework.format.annotation.DateTimeFormat;

import static cn.iocoder.an.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;

/**
 * 设备台账 DO
 *
 * @author zzy
 */
@TableName(value = "business_equipment_manage",autoResultMap = true)
@KeySequence("business_equipment_manage_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库，可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class EquipmentManageDO extends BaseDO {

    /**
     * 设备ID
     */
    @TableId
    private Long id;
    /**
     * 设备编码
     */
    private String code;
    /**
     * 设备名称
     */
    private String equipmentName;
    /**
     * 所属部门
     */
    private Long deptId;
    /**
     * 所属部门名称
     */
    private String deptName;
    /**
     * 设备分类
     */
    private Long equipmentClassify;

    /**
     * 设备分类名称
     */
    private String equipmentClassifyName;

    /**
     * 设备状态
     *
     * 枚举 {@link TODO equipment_status 对应的类}
     */
    private Integer equipmentStatus;
    /**
     * 设备类型
     *
     * 枚举 {@link TODO equipment_type 对应的类}
     */
    private Integer equipmentType;
    /**
     * 规格型号
     */
    private String equipmentModel;
    /**
     * 设备功率kw
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "#0.00")
    private String equipmentPower;
    /**
     * 设备重量
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "#0.00")
    private String equipmentWeight;
    /**
     * 设备吨位
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "#0.00")
    private String equipmentTonnage;
    /**
     * 安装位置
     */
    private String installPosition;
    /**
     * 安装日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date installDate;
    /**
     * 投产日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date productionDate;
    /**
     * 单位
     */
    private String unit;
    /**
     * 设备厂家
     */
    private String equipmentProducer;
    /**
     * 联系人
     */
    private String contacts;
    /**
     * 联系电话
     */
    private String contactsNumber;
    /**
     * 使用状态
     *
     * 枚举 {@link TODO equipment_status 对应的类}
     */
    private Integer useType;
    /**
     * 最近一次保养时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(updateStrategy = FieldStrategy.ALWAYS)
    private LocalDateTime maintainDatetime;
    /**
     * 下次保养时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(updateStrategy = FieldStrategy.ALWAYS)
    private LocalDateTime nextMaintainDatetime;
    /**
     * 备注
     */
    private String remark;


    /**
     * 最近一次点检时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(updateStrategy = FieldStrategy.ALWAYS)
    private LocalDateTime lastCheckTime;
    /**
     * 下次点检时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(updateStrategy = FieldStrategy.ALWAYS)
    private LocalDateTime nextCheckTime;

    //维护人员
    @TableField(typeHandler = JacksonTypeHandler.class)
    private List<Long> maintenanceUserId;

    //维护人员
    private String maintenanceUserName;


    /**
     * 最近一次维护时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(updateStrategy = FieldStrategy.ALWAYS)
    private LocalDateTime lastMaintainTimeDamage;
    /**
     * 下次维护时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(updateStrategy = FieldStrategy.ALWAYS)
    private LocalDateTime nextMaintainTimeDamage;

    //易损品维护人员
    @TableField(typeHandler = JacksonTypeHandler.class)
    private List<Long> maintenanceUserIdDamage;

    //易损品维护人员
    private String maintenanceUserNameDamage;


}